import {eventBus, EventName} from "@/event/event.ts";
import {GlobalMessage} from "@/event/eventglobalmessage.ts";

export function sendGlobalMessage(message: GlobalMessage | string) {
    if (typeof message == 'string') {
        const globalMessage = new GlobalMessage().buildMessage(message)
        eventBus.emit(EventName.GLOBAL_MESSAGE, globalMessage)
    } else {
        eventBus.emit(EventName.GLOBAL_MESSAGE, message)
    }

}